void TestDeamon()
{
        pid_t pid=fork();
        if(pid>0)
        {
                            exit(0);
        }

        cout<<"My Parent Pid:"<<getppid()<<endl;
        pid_t pRet=setsid();  //设置依赖进程为?
        if(pRet<0)
       {
            perror("setsid failed");
            return;
        }
        chdir("/home/liushiyin");
        close(STDIN_FILENO);
        close(STDOUT_FILENO);
        close(STDERR_FILENO);
        pid_t pid1=fork();
        if(pid1==0)
        {
            execl("/usr/bin/gedit","gedit","test.txt",NULL);
        }
        while(true)
        {
            wait(NULL);
            pid_t pid1=fork();
            if(pid1==0)
            {
                execl("/usr/bin/gedit","gedit","test.txt",NULL);
            }
        }
}
